package com.tensquare.recurit.controller;

import com.tensquare.recurit.pojo.Recruit;
import com.tensquare.recurit.service.RecruitService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("recruit")
public class RecruitController {

    @Autowired
    private RecruitService recruitService;

    //1.查询推荐职位列表
    @GetMapping("search/recommend")
    public Result recommend(){
        //1.调用服务查询
        List<Recruit> recruitList=recruitService.findByRecommend();
        //2.返回结果
        return new Result(true,StatusCode.OK,"查询推荐职位列表成功!",recruitList);
    }

    //2查询最新职位的列表
    @GetMapping("search/newlist")
    public Result createTime(){
        //1.调用服务查询
        List<Recruit> byCreateTime = recruitService.findByCreateTime();
        //2.返回结果
        return new Result(true,StatusCode.OK,"查询最新职位列表成功！",byCreateTime);
    }
}
